'use strict';

var entityController = require('../controllers/Entity.server.controller'),
    BaseFun = require('../controllers/Function');

module.exports = function(app) {
    // app.route('/api/entity/save').post(entityController.save);
    // app.route('/api/entity/saves').post(entityController.saves);

    // app.route('/api/entity/updateByValue').post(entityController.updateByValue);

    // app.route('/api/entity/delete').post(entityController.delete);
    // app.route('/api/entity/deletes').post(entityController.deletes);
    // app.route('/api/entity/deleteById').post(entityController.deleteById);
    // app.route('/api/entity/deleteByIds').post(entityController.deleteByIds);
    // app.route('/api/entity/deleteByCondition').post(entityController.deleteByCondition);

    //app.route('/api/entity/find').post(entityController.find);
    // app.route('/api/entity/findById').post(entityController.findById);
    // app.route('/api/entity/findOne').post(entityController.findOne);
    // app.route('/api/entity/search').post(entityController.search);

    // app.route('/api/entity/pageQuery').post(entityController.pageQuery);
    // app.route('/api/entity/queryRecordCount').post(entityController.queryRecordCount);
    // app.route('/api/entity/findRecordIndex').post(entityController.findRecordIndex);

    // app.route('/api/entity/distinct').post(entityController.distinct);
    // app.route('/api/entity/aggregate').post(entityController.aggregate);
    // app.route('/api/entity/mapReduce').post(entityController.mapReduce);

    // app.route('/api/entity/getEntityMetadata').post(entityController.getEntityMetadata);
};

BaseFun.addRoute('/api/entity/save', entityController.save);
BaseFun.addRoute('/api/entity/saves', entityController.saves);

BaseFun.addRoute('/api/entity/updateByValue', entityController.updateByValue);

BaseFun.addRoute('/api/entity/delete', entityController.delete);
BaseFun.addRoute('/api/entity/deletes', entityController.deletes);
BaseFun.addRoute('/api/entity/deleteById', entityController.deleteById);
BaseFun.addRoute('/api/entity/deleteByIds', entityController.deleteByIds);
BaseFun.addRoute('/api/entity/deleteByCondition', entityController.deleteByCondition);

BaseFun.addRoute('/api/entity/find', entityController.find, '通用查找');
BaseFun.addRoute('/api/entity/findById', entityController.findById, '按id查找');
BaseFun.addRoute('/api/entity/findOne', entityController.findOne, '查找一个');
BaseFun.addRoute('/api/entity/search', entityController.search, '全文查找');

BaseFun.addRoute('/api/entity/pageQuery', entityController.pageQuery, '按页查找');
BaseFun.addRoute('/api/entity/queryRecordCount', entityController.queryRecordCount, '查找记录条数');
BaseFun.addRoute('/api/entity/findRecordIndex', entityController.findRecordIndex, '查找记录所在位置');

BaseFun.addRoute('/api/entity/distinct', entityController.distinct);
BaseFun.addRoute('/api/entity/aggregate', entityController.aggregate);
BaseFun.addRoute('/api/entity/mapReduce', entityController.mapReduce);

BaseFun.addRoute('/api/entity/getEntityMetadata', entityController.getEntityMetadata);
// require(path.resolve(routePath))(app);